package com.qf.fmall.user.controller;

import com.qf.fmall.utils.TokenUtils;
import com.qf.fmall.vo.ResultVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/test")
public class TestController {

    @GetMapping("/token")
    public ResultVo testToken(HttpServletRequest request){

        String token = request.getHeader("token");

        // 校验token 的合法性
//        boolean flag = TokenUtils.checkToken(token);
        boolean flag = TokenUtils.checkJWT(token);

        return new ResultVo(200,"ok",flag);
    }

}
